﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
using System.Windows.Input;
using System.Windows.Threading;
using AutoMapper;
using Microsoft.Practices.Prism;
using Microsoft.Practices.Prism.Commands;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Prism.ViewModel;
using Sautom.ClientComunication;
using Sautom.ClientComunication.QueriesService;
using Sautom.ClientComunication.ReportService;
using Sautom.ClientComunication.Services;
using Sautom.Modules.Report.Commands;
using Sautom.Modules.Report.Controls.ViewModels;

namespace Sautom.Modules.Report.ViewModels
{
    public sealed class OrdersReportViewModel : NotificationObject
    {
        #region Constructor
        public OrdersReportViewModel(IRegionManager regionManager, ServiceFactory serviceFactory)
        {
            RegionManager = regionManager;
            
            BuilderViewModel = new OrderQueryBuilderViewModel(new RequestOrderReportsCommand(this, serviceFactory.GetReportesService()));
        }
        #endregion

        #region Tech properties
        private IRegionManager RegionManager { get; set; }
        #endregion

        #region Commands
        public ICommand UpdateResultsCommand { get; private set; }
        #endregion

        #region For View properties
        public OrderQueryBuilderViewModel BuilderViewModel { get; set; }

        private ObservableCollection<OrderReportDtoReport> _records;
        public ObservableCollection<OrderReportDtoReport> Records
        {
            get { return _records; }
            set
            {
                _records = value;
                RaisePropertyChanged(() => Records);
            }
        }

        #endregion

        #region Private members

        #endregion
    }
}